/**
 * 
 */
package org.cuatrovientos.erp.business;

import java.util.List;

import org.apache.log4j.Logger;
import org.cuatrovientos.erp.dao.IssueDAOInterface;
import org.cuatrovientos.erp.model.Issue;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Raquel Valenzuela <raquel_valenzuela@cuatrovientos.es>
 *
 */
public class IssueBO implements IssueBOInterface {
	// Get log4j logger
	private static final Logger logger = Logger.getLogger(IssueBO.class);
				
	@Autowired
	private IssueDAOInterface issueDAO;
		
		
	/**
	 * selectById
	 * @param int id
	 * @return Issue with that id
	 */
	@Override
	public Issue selectById(int id) {
		logger.info("selectById: " + id);
		return issueDAO.selectById(id);
	}

	/**
	 * selectAll
	 * @return list of Issues
	 */
	@Override
	public List<Issue> selectAll() {
		logger.info("selectAll: ");
		return issueDAO.selectAll();
	}

	/**
	 * search
	 * @param String name
	 * @return List of issues with that name
	 */
	@Override
	public List<Issue> search(String name) {
		logger.info("search : " + name);
		return issueDAO.search(name);
	}

	/**
	 * deleteById
	 * @param int id
	 */
	@Override
	public void deleteById(int id) {
		logger.info("delete by: " + id + " id");
		issueDAO.deleteById(id);

	}

	/**
	 * insert
	 * @param issue to insert
	 */
	@Override
	public void insert(Issue issue) {
		logger.info("insert: " + issue);
		issueDAO.insert(issue);

	}

	/**
	 * update
	 * @param Issue to update
	 */
	@Override
	public void update(Issue issue) {
		logger.info("update: " + issue);
		issueDAO.update(issue);
	}

	/**
	 * delete
	 * @param issue to delete
	 */
	@Override
	public void delete(Issue issue) {
		logger.info("delete: " + issue);
		issueDAO.delete(issue);

	}

}
